package com.example.wp_test;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private static final int OUTPUT_COUNT = 19;
    private static final int INPUT_COUNT = 16;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        initDemo();


    }

    private void initDemo() {
        Gpio_test();

    }

    private void Gpio_test() {
        Button btnAllOutHigh = findViewById(R.id.btnAllOutHigh);
        Button btnAllOutLow = findViewById(R.id.btnAllOutLow);
        Button btnCheckInput = findViewById(R.id.btnCheckInput);
        TextView tvResult = findViewById(R.id.tvResult);

        btnAllOutHigh.setOnClickListener(v ->
                GpioHelper.setAllOutHigh(this, tvResult, OUTPUT_COUNT)
        );

        btnAllOutLow.setOnClickListener(v ->
                GpioHelper.setAllOutLow(this, tvResult, OUTPUT_COUNT)
        );

        btnCheckInput.setOnClickListener(v ->
                GpioHelper.checkAllInput(this, tvResult, INPUT_COUNT)
        );

    }
}